'use strict';
module.exports = {
	/**
	 * XXXnameXXX
	 * @url client/pages/order/kh/get_all_history 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------
		let dbName = "daoju_order"; // 表名
		
		let result = {}


		result.consumption_price = await vk.baseDao.sum({
			dbName,
			fieldName: "amount_payment", // 需要求和的字段名
			whereJson: {
				status: _.gte(1),
				user_id: uid
			}
		});
		
		result.order_count = await vk.baseDao.count({
			dbName,
			whereJson: {
				status: _.gte(1),
				user_id: uid
			}
		});
		result
		res.data = result

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
